# -*- coding:utf-8 -*-
# generator

def fib(count):
    a,b =0,1
    n = 0
    while n < count:
        a,b = b, a+b
        yield b
        n += 1
    return 'over'

fib_generator = fib(5)
fib_generator2 = fib(5)
print(fib_generator)
for i in fib_generator:
    print(i)

while True:
    try:
        print(next(fib_generator2))
    except StopIteration as e:
        print(e.value) # over
        break